package com.fly.swt.window;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Window
{
    protected Shell shell;
    
    /**
     * Launch the application.
     * 
     * @param args
     */
    public static void main(String[] args)
    {
        try
        {
            Window window = new Window();
            window.open();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
    
    /**
     * Open the window.
     */
    public void open()
    {
        Display display = Display.getDefault();
        createContents();
        shell.open();
        shell.layout();
        while (!shell.isDisposed())
        {
            if (!display.readAndDispatch())
            {
                display.sleep();
            }
        }
    }
    
    /**
     * Create contents of the window.
     */
    protected void createContents()
    {
        shell = new Shell();
        shell.setSize(450, 300);
        shell.setText("SWT Application");
        Composite composite = new Composite(shell, SWT.NONE);
        composite.setBounds(0, 0, 500, 400);
    }
}
